package com.example.hao.aidl_service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

import com.xykj.aidl.IMyAidlInterface;
import com.xykj.aidl.Student;

public class MyService extends Service {
    public MyService() {
    }

    public static final String TAG = "MyService";

    @Override
    public IBinder onBind(Intent intent) {

        return new IMyAidlInterface.Stub() {
            @Override
            public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {

                Log.d(TAG, "basicTypes: anInt " + anInt);
                Log.d(TAG, "basicTypes: aLong " + aLong);
                Log.d(TAG, "basicTypes: aBoolean " + aBoolean);
                Log.d(TAG, "basicTypes: aFloat " + aFloat);
                Log.d(TAG, "basicTypes: aDouble " + aDouble);
                Log.d(TAG, "basicTypes: aString " + aString);
            }

            @Override
            public void setStudent(Student stu) throws RemoteException {
                Log.i(TAG, "setStudent: "+stu);
            }

            @Override
            public void getStudent(Student stu) throws RemoteException {
                Log.i(TAG, "setStudent: "+stu);
                stu.setAge(30);
                stu.setName("李四");
                stu.setSex('女');
            }

        };
    }

}
